<script setup lang="ts">
import { ref } from 'vue'

type Todo = {
  id: number
  title: string
  finished: boolean
}

// 1. ref函数加类型
const todoList = ref<Todo[]>([
  { id: 1, title: '敲代码', finished: false },
  { id: 2, title: '打篮球', finished: false },
  { id: 3, title: '踢足球', finished: true },
])
</script>

<template>
  <div>
    <ul>
      <li v-for="item in todoList" :key="item.id">
        序号: {{ item.id }}, 任务: {{ item.title }}, 完成情况:
        {{ item.finished ? '完成' : '未完成' }}
      </li>
    </ul>
  </div>
</template>

<style scoped></style>